﻿using System;
using System.Net;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Subgurim.Controles;
using System.Net.Sockets;

namespace WebApplication1
{ 
    public partial class _Default : System.Web.UI.Page
    {
        private double lat;
        private double lng;
        GMarker mark;

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                GMap1.Language = "de";
                GMap1.Add(new GMapUI());
                GMap1.setCenter(new GLatLng(49.2401572, 6.9969327), 10);
                GMap1.enableHookMouseWheelToZoom = true;
                GMap1.mapType = GMapType.GTypes.Hybrid;
                GMap1.Add(GMapType.GTypes.Physical);
                GMap1.Add(GMapType.GTypes.Normal);
                GMap1.Add(GMapType.GTypes.Satellite);
                GMap1.Add(new GControl(GControl.preBuilt.MapTypeControl));
                GMap1.enableRotation = true;
                lat = lng = 0;
            }
        }

        protected void Marker_Click(object sender, EventArgs e)
        {
            try
            {
                GMap1.resetMarkers();
                lat = (double)Cache.Get("lat");
                lng = (double)Cache.Get("lng");
            }
            catch (NullReferenceException e1)
            {
                lat = -100;
                lng = -100;
            }
            debug.Text = lat + " " + lng;
            mark = new GMarker(new GLatLng(lat+=10, lng+=10));
            GMap1.Add(mark);
            Cache.Insert("lat", lat);
            Cache.Insert("lng", lng);
        }
    }
}